﻿Public Class SuperSmallButton
    Inherits Windows.Forms.Button

    Public Event OnClickOrPress(ByRef sender As SuperSmallButton)

    Private Sub me_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Click
        Windows.Forms.SendKeys.Send("{TAB}")
    End Sub

    Private Sub me_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
        If e.KeyCode = Windows.Forms.Keys.Return Then
            If e.Control Then
                Call me_MouseUp(sender, New System.Windows.Forms.MouseEventArgs(Windows.Forms.MouseButtons.Left, 1, MousePosition.X, MousePosition.Y, 1))
            End If
        End If
    End Sub

    Private Sub me_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        If e.Button = Windows.Forms.MouseButtons.Right Then Return
        RaiseEvent OnClickOrPress(Me)
    End Sub

End Class
